package android.slc.mp.ui.page.video;

import android.os.Bundle;
import android.slc.mp.R;
import android.slc.mp.po.i.IVideoFolder;
import android.slc.mp.po.i.IVideoItem;
import android.slc.mp.po.i.IVideoResult;
import android.slc.mp.ui.page.SlcMpBaseMpAdapter;
import android.slc.mp.ui.page.SlcMpPagerBaseVd;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;

import java.util.List;

/**
 * Created by slc
 */
public class SlcMpPagerVideoVd extends SlcMpPagerBaseVd<IVideoResult, IVideoFolder, IVideoItem> {
    private TextView tv_select_folder;

    @Override
    public void slcMtBindView(@Nullable Bundle savedInstanceState) {
        super.slcMtBindView(savedInstanceState);
        tv_select_folder = findViewById(R.id.tv_select_folder);
        findViewById(R.id.ll_select_folder).setOnClickListener(this);
    }

    @Override
    protected int getMediaPickerViewId() {
        return R.id.recyclerView;
    }

    @Override
    protected SlcMpBaseMpAdapter<IVideoItem> getMediaPickerAdapter(List<IVideoItem> data) {
        return new SlcMpVideoAdapter(requireActivity(), data, mMpVirtualVm.getMediaPickerDelegate());
    }

    @Override
    protected int getContentView() {
        return R.layout.slc_mp_video_fragment;
    }

    @Override
    protected void setSelectFolderName(String folderName) {
        tv_select_folder.setText(folderName);
        findViewById(R.id.ll_select_folder).setVisibility(folderName == null ? View.GONE : View.VISIBLE);
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.ll_select_folder) {
            showSwitchFolderDialog(v);
        }
    }

}
